﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class hydevmanager_admin_edit_album : System.Web.UI.Page
{
    public int idphoto = 0;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Session["timeout"] == null)
            {
                Response.Redirect("login.aspx");
            }
            {


                load_photo();
            }
        }
    }

    protected void load_photo()
    {
        grAllphoto.DataSource = DataAccess.ExeSQLToDataTable("Select * FROM dev_album_detail where idalbum=9");
        grAllphoto.DataBind();
        //string str=Request.UserHostAddress.ToString();
    }

    protected void grAllphoto_click(object sen, CommandEventArgs e)
    {
        string Argvalue = e.CommandArgument.ToString();
        char[] ch = new char[] { '|' };

        string[] s = ITNLip.SplitString(Argvalue, ch);
        string id = s[0];
        string action = s[1];

        switch (action)
        {
            case "edit":
                txtEdit.Focus();
                idphoto = Convert.ToInt32(s[0]);
                break;

            case "delete":
                int idimg = Convert.ToInt32(s[0]);
                DataAccess.ExeNonSQL("DELETE FROM dev_album_detail WHERE idphoto=" + idimg + "");
                break;
        }

        load_photo();
    }
}
